package org.zoomdev.zoom.dao.datasource;

import org.zoomdev.zoom.dao.ConnectionProvider;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public final class SingleConnectionProvider implements ConnectionProvider {
    private final DataSource dataSource;

    public SingleConnectionProvider(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    @Override
    public Connection getConnection() throws SQLException {
        return dataSource.getConnection();
    }

    @Override
    public DataSource getDataSource() {
        return dataSource;
    }
}
